﻿<html DIR="LTR" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ddue="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
  <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8" />
    <META NAME="save" CONTENT="history" />
    <title>Connecting to SQL Server with the JDBC Driver</title>
    
    <link rel="stylesheet" type="text/css" href="../local/Classic.css">
      
    </link>
    
    <script src="../local/script.js">
      
    </script><script src="../local/script_main.js">&amp;nbsp;</script>
  </head>
  <body>
    <!--Topic built:03/26/2010 02:49:39-->

    
    
    
    
    
    
    
    
    
    <div id="header">
      <table width="100%" id="topTable"><tr>
          <td align="left">
            <span id="headerBold">Connecting to SQL Server with the JDBC Driver</span>
          </td>
          <td align="right">
            
          </td>
        </tr></table>
      
      
      
    </div>
    <div id="mainSection">
      
        
        
    <font color="DarkGray">
      
    </font>
    <p />
    
    <p />
  
        <div id="introductionSection" class="section">
    <p>One of the most fundamental things that you will do with the Microsoft SQL Server JDBC Driver is to make a connection to a SQL Server database. All interaction with the database occurs through the <a href="937292a6-1525-423e-a2b2-a18fd34c2893.htm">SQLServerConnection</a> object, and because the JDBC driver has such a flat architecture, almost all interesting behavior touches the <b>SQLServerConnection</b> object.</p>
    <p>If a SQL Server is only listening on an IPv6 port, set the set the java.net.preferIPv6Addresses system property to make sure that IPv6 is used instead of IPv4 to connect to the SQL Server:</p>
    <div class="sampleCode"><span codeLanguage="other"><pre>System.setProperty("java.net.preferIPv6Addresses", "true");</pre></span></div>
    <p>The topics in this section describe how to make and work with a connection to a SQL Server database. </p>
  </div><h1 class="heading">In This Section</h1><div id="inThisSectionSection" class="section">
    <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <table width="100%" cellspacing="0" cellpadding="0" border="1" style="background-color: #CCCCCC;" xmlns=""><tr>
            <th>
              Topic
            </th>
            <th>
              Description
            </th>
          </tr><tr>
          <td>
            <p>
              <a href="44996746-d373-4f59-9863-a8a20bb8024a.htm">Building the Connection URL</a>
            </p>
          </td>
          <td>
            <p>Describes how to form a connection URL for connecting to a SQL Server database. Also describes connecting to named instances of a SQL Server database.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="f1b62700-f046-488d-bd6b-a5cd8fc345b7.htm">Setting the Connection Properties</a>
            </p>
          </td>
          <td>
            <p>Describes the various connection properties and how they can be used when you connect to a SQL Server database.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="f3363d05-07fc-4bf8-ae5e-2a7a968808ad.htm">Setting the Data Source Properties</a>
            </p>
          </td>
          <td>
            <p>Describes how to use data sources in a Java Platform, Enterprise Edition (Java EE) environment.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="cf8ee392-8a10-40a3-ae32-31c7b1efdd04.htm">Working with a Connection</a>
            </p>
          </td>
          <td>
            <p>Describes the various ways in which to create an instance of a connection to a SQL Server database.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="699d4e8a-34bf-4c60-b0d5-4a10dad6084a.htm">Using Connection Pooling</a>
            </p>
          </td>
          <td>
            <p>Describes how the JDBC driver supports the use of connection pooling.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="4ff59218-0d3b-4274-b647-9839c4955865.htm">Using Database Mirroring (JDBC)</a>
            </p>
          </td>
          <td>
            <p>Describes how the JDBC driver supports the use of database mirroring.</p>
          </td>
        </tr></table>
    </content>
  </div><span id="seeAlsoSpan"><h1 class="heading">See Also</h1></span><div id="seeAlsoSection" class="section" name="collapseableSection"><a href="939a8773-2583-49a4-bf00-6b892fbe39dc.htm">Overview of the JDBC Driver</a><br /><br /></div><!--[if gte IE 5]>
			<tool:tip element="seeAlsoToolTip" avoidmouse="false"/><tool:tip element="languageFilterToolTip" avoidmouse="false"/><tool:tip element="roleInfoSpan" avoidmouse="false"/>
		<![endif]-->
      <div id="footer" class="section">
        
		<hr />
		
		<span id="fb" class="feedbackcss">
			
			
		</span>
		
		<a href="9bad553b-9e70-4696-8499-2e35f772a1e0.htm">
			
			© 2010 Microsoft Corporation. All rights reserved.
		</a>
 	
	
      </div>
    </div>
  </body>
</html>